package com.sport.config;

import com.sport.properties.AliOssProperties;
import com.sport.utils.AliOssUtil;
import lombok.extern.slf4j.Slf4j;
import org.springframework.boot.autoconfigure.condition.ConditionalOnMissingBean;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;

@Configuration
@Slf4j
public class OssConfiguration {
    @Bean
    @ConditionalOnMissingBean
    public AliOssUtil aliOssUtil(AliOssProperties aliasesOssProperties) {
        log.info("开始创建对象 {}",aliasesOssProperties);
        return new AliOssUtil(aliasesOssProperties.getEndpoint(),
                aliasesOssProperties.getAccessKeyId(),
                aliasesOssProperties.getAccessKeySecret(),
                aliasesOssProperties.getBucketName());
    }
}
